package fserv.ni;

import fserv.entities.Message;
import java.net.InetAddress;

/**
 * Communication interface: ChatController => ChatNI
 * 
 * @author Arthur Bit-Monnot <abit@etud.insa-toulouse.fr>
 * @author Julien Marchand <jmarchan@etud.insa-toulouse.fr>
 */
public interface CtrlToNI extends Runnable {
    /**
     * Broadcasts a message to all remote peers.
     * 
     * @param m the message to send
     */
    void send(Message m);
    
    /**
     * Sends a message to a specified remote peer.
     * 
     * @param m the message to send
     * @param addr the InetAddress of the recipient of the message
	 * @param port the Port of the recipient of the message
     */
    void send(Message m, InetAddress addr, int port);

    /**
     * Gracefully stops the network interface.
     * Closes the listening socket.
     * @param niThread the thread the NI is running on
     */
    public void stop(Thread niThread);
}
